<?php
/**
 *
 *
 *
 */

include_once('../Model/User.php');
include_once('../Model/UserDetail.php');

if(isset($_POST)) {

	// Get userName. passWord from request
	$userName = $_POST['txtUserName'];
	$passWord = $_POST['txtPassWord'];

	$user = new User();
	$userDetail = new UserDetail();

	// Check user name and password are correct or not
	$isSuccess = $user->checkSignIn($userName, $passWord);

	if($isSuccess) {
		
		// Get friends list
		$friends = $user->getFriendsList($_SESSION['USER_ID']);
		
		$userDetail = $userDetail->getUserDetail($_SESSION['USER_ID']);

		// Truyen qua userInfo mot doi tuong UserDetail
		//$userID = ;
		//

		require('../View/v_Home.php');
	} else {
		header('location:../View/v_SignIn.php?err');
	}
}
?>